package selenium.demo;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

/**
 * @Author quan
 * @Description 打印百度首页的URL
 * @Date 2023/8/14 12:18
 */
public class Demo6_CheckUrl {
    public static void main(String[] args) {
        //1、打开百度首页
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        WebDriver webDriver = new ChromeDriver(options);
        webDriver.get("https://www.baidu.com/");
        //2、获取URL
        String str = webDriver.getCurrentUrl();
        //3、比较获取的URL是否正确
        if(str.equals("https://www.baidu.com/")){
            System.out.println("正确");
        }else{
            System.out.println("错误");
        }
        webDriver.quit();
    }
}
